package com.hksj.common.core.common;

/**
 * 性别 0 = 未知性别 1 = 男 2 = 女 9 = 未说明的性别
 */
public enum Sex{

    /**
     * 性别 0 = 未知性别 1 = 男 2 = 女 9 = 未说明的性别
     */
    UNKNOWN(0,"未知性别"),
    MALE(1,"男"),
    FEMALE(2,"女"),
    UNDEFINED(9,"未说明的性别");

    private final Integer value;
    private final String code;

    Sex(Integer value, String code){
        this.value = value;
        this.code = code;
    }

    public Integer value(){
        return this.value;
    }

    public String code(){return this.code;}

    public static String getCodeByValue(Integer value){
        for (Sex sex : values()) {
            if (sex.value().equals(value)) {
                return sex.code();
            }
        }
        return null;
    }
}
